<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  自动变height
  <textarea onpropertychange="this.style.posHeight=this.scrollHeight"></textarea>
  <textarea style="overflow-y:visible; width: 300px;"></textarea>
  <textarea onpropertychange='this.style.posHeight=this.scrollHeight' id=textarea onfocus='textarea.style.posHeight=this.scrollHeight'></textarea>
  <!-- <textarea style="height:((this.scrollHeight>150)?'150px':(this.scrollHeight+5)+'px');overflow:auto;"></textarea> -->
</body>
</html>